package com.todo.server.DAO;

import com.todo.server.DAO.action.ActionDAOImpl;
import com.todo.server.DAO.action.model.ActionDAO;
import com.todo.server.DAO.type.TypeDAOImpl;
import com.todo.server.DAO.type.model.TypeDAO;
import com.todo.server.DAO.user.UserDAOImpl;
import com.todo.server.DAO.user.model.UserDAO;

public class Factory {

	private ActionDAO actionDAO = null;
	private UserDAO userDAO = null;
	private TypeDAO typeDAO = null;
	
	private volatile static Factory instance=null;
	private Factory() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	public static Factory getInstance(){
		if(instance==null){
			synchronized (Factory.class) {
				if(instance==null){
					instance = new Factory();
				}				
			}
		}
		return instance;
	}
	
	public ActionDAO getActionDAO(){
		if(actionDAO==null){
			actionDAO = new ActionDAOImpl();
		}
		return actionDAO;
	}
	
	public UserDAO getUserDAO(){
		if(userDAO==null){
			userDAO=new UserDAOImpl();
		}
		return userDAO;
	}
	
	public TypeDAO getTypeDAO(){
		if(typeDAO==null){
			typeDAO = new TypeDAOImpl();
		}
		return typeDAO;
	}
}
